<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('records', function (Blueprint $table) {
            $table->id();
            $table->string("wechat_id")->comment("微信ID");
            $table->string("video_id")->comment("视频ID");
            $table->string("video_nickname")->nullable()->comment("视频号昵称");
            $table->string("order_img")->comment("成交截图");
            $table->foreignId("user_id")->nullable()->constrained()->onDelete("set null");
            $table->text("remark")->nullable()->comment("备注");
            $table->timestamp("start_at")->default(\Carbon\Carbon::now())->comment("开始时间");
            //过期时间为当前时间向后延期30天，使用carbon
            $table->timestamp("expired_at")->default(\Carbon\Carbon::now()->addDays(30))->comment("过期时间");
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('records');
    }
};
